﻿@namespace AntDesign
@inherits AntDomComponentBase
@using AntDesign.Internal

<div class="@ClassMapper.Class"
     style="@Style"
     id="@Id"
     @ref="@Ref">
    @if (HeaderRender != null)
    {
        @HeaderRender.Invoke(new CalendarHeaderRenderArgs {
            Value = Value,
            Type = Mode,
            OnChange = new EventCallbackFactory().Create<DateTime>(this, ChangeValue),
            OnTypeChange = new EventCallbackFactory().Create<string>(this, ChangePickerType),
        });
    }
    else
    {
        <CascadingValue Value="this" Name="Calendar">
            <CascadingValue Value="PrefixCls" Name="PrefixCls">
                <CalendarHeader />
            </CascadingValue>
        </CascadingValue>
    }
    
    <CalendarPanelChooser Calendar="@this" PickerIndex="0" OnSelect="async (date, index) => await OnSelectValue(date)" />
</div>